<?php

namespace App\Entity\Sale;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Base\Annotation\Common;
use App\Entity\User;
use App\Repository\Sale\SaleJuanLogRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ApiResource()
 * @ORM\Entity(repositoryClass=SaleJuanLogRepository::class)
 */
class SaleJuanLog
{
    /**
     * @Common(cnName="#",listType="text",editType="text")
     * @Groups({"sale","juan"})
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @Common(cnName="优惠券",listType="text",editType="text",width="")
     * @Groups({"sale","juan"})
     * @ORM\ManyToOne(targetEntity=SaleJuan::class, inversedBy="logs")
     * @ORM\JoinColumn(nullable=false)
     */
    private $juan;

    /**
     * @Common(cnName="用户",listType="text",editType="text",width="210")
     * @Groups({"sale","juan"})
     * @ORM\ManyToOne(targetEntity=User::class)
     * @ORM\JoinColumn(nullable=false)
     */
    private $user;

    /**
     * @Common(cnName="编码",listType="text",editType="text",width="210")
     * @Groups({"sale","juan"})
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $sn;

    /**
     * @Common(cnName="状态",listType="text",editType="select")
     * @Groups({"sale","juan"})
     * @ORM\Column(type="integer")
     */
    private $status;

    /**
     * @Common(cnName="过期时间",listType="text",editType="datetime",width="180")
     * @Groups({"sale","juan"})
     * @ORM\Column(type="datetime")
     */
    private $expireAt;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getJuan(): ?SaleJuan
    {
        return $this->juan;
    }

    public function setJuan(?SaleJuan $juan): self
    {
        $this->juan = $juan;

        return $this;
    }

    public function getUser(): ?User
    {
        return $this->user;
    }

    public function setUser(?User $user): self
    {
        $this->user = $user;

        return $this;
    }

    public function getSn(): ?string
    {
        return $this->sn;
    }

    public function setSn(?string $sn): self
    {
        $this->sn = $sn;

        return $this;
    }

    public function getStatus(): ?int
    {
        return $this->status;
    }

    public function setStatus(int $status): self
    {
        $this->status = $status;

        return $this;
    }

    public function getExpireAt(): ?\DateTimeInterface
    {
        return $this->expireAt;
    }

    public function setExpireAt(\DateTimeInterface $expireAt): self
    {
        $this->expireAt = $expireAt;

        return $this;
    }
}
